package cn.explink.dop.distributor.condition;

import java.util.List;

import cn.explink.distributor.framework.Condition;

public class DeliveryArea extends MatchableCondition {

	private static final long serialVersionUID = 3750690103574017458L;

	// 配送员所属区域可能有多个，订单可能落在多个区域交集处
	private List<String> areaIdList;

	public DeliveryArea() {
		super();
	}

	@Override
	public boolean isMatched(Condition condition) {
		for (String orderAreaId : this.areaIdList) {
			for (String deliveryManAreaId : ((DeliveryArea) condition).getAreaIdList()) {
				if (orderAreaId.equals(deliveryManAreaId)) {
					return true;
				}
			}
		}
		return false;
	}

	public List<String> getAreaIdList() {
		return this.areaIdList;
	}

	public void setAreaIdList(List<String> areaIdList) {
		this.areaIdList = areaIdList;
	}

}
